package com.lihao.sam.controller;

import com.lihao.sam.entity.EmpSetting;
import com.lihao.sam.service.intf.EmpSettingService;
import com.lihao.sam.vo.PageVo;
import com.lihao.sam.vo.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

/**
 * @ClassName EmpSettingController
 * @Description TODO
 * @Author LiHao
 * @Date 2022/11/23 14:58
 * @Version 1.0
 */
@RestController
@RequestMapping("/api/emp/")
public class EmpSettingController {
    @Resource
    private EmpSettingService service;

    @PostMapping("add.do")
    public R add(EmpSetting empSetting) {
        return service.add(empSetting);
    }

    @PostMapping("update.do")
    public R update(EmpSetting empSetting) {
        return service.update(empSetting);
    }

    @PostMapping("delete.do")
    public R delete(int id, HttpSession session) {
        return service.delete(id);
    }

    @GetMapping("page.do")
    public PageVo page(int page, int limit, String empNo, String empName, String nativePlace) {
        System.out.println(service.queryPage(page, limit, empNo, empName, nativePlace));
        return service.queryPage(page, limit, empNo, empName, nativePlace);
    }
    @PostMapping("deletebatch.do")
    public R deleteBatch(int[] ids) {
        return service.deleteBatch(ids);
    }
}
